﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace PortalWeb.CMS.Web
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "CMS_Default",
                url: "CMS/{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", plugin = "cms", id = UrlParameter.Optional },
                namespaces: new string[] { "PortalWeb.CMS.Web.Controllers" }
                );

            routes.MapRoute(
                name: "CmsAdmin_default",
                 url: "CMS/Admin/{controller}/{action}/{id}",
                defaults: new { action = "Index", Area = "CmsAdmin", plugin = "Cms", id = UrlParameter.Optional },
                namespaces: new string[] { "PortalWeb.CMS.Web.Areas.Admin.Controllers" }
                  );
        }

        public static void RemoveRoutes(RouteCollection routes)
        {
            routes.Remove(routes["CMS_Default"]);
            routes.Remove(routes["CmsAdmin_default"]);
        }
    }
}
